<template>
  <div class="page-content">
    <a-card style="width: 100%; height: 100%" v-if="!showDetail">
      <div class="header">
        <Condition
          :condition="condition"
          :btns="['search', 'reset']"
          @search="searchHandle"
          @reset="reset"
        />
        <div class="total">
          <span> 共筛选出 {{ pagination.total }} 条数据 </span>
          <div class="right">
            <!-- <a-badge class="btn" :count="1" :overflow-count="999" @click="handleReport">
                <a-button type="primary" ghost>手动上报</a-button>
              </a-badge>
              <a-badge class="btn" :count="1" :overflow-count="999" @click="handleNotice">
                <a-button type="primary">通知失败</a-button>
              </a-badge> -->
            <a-badge
              class="btn"
              :count="abnormalWaitApprovalCount"
              :overflow-count="999"
              @click="handleExamine('')"
            >
              <a-button type="primary">异常结果审核</a-button>
            </a-badge>
          </div>
        </div>
      </div>
      <div class="main">
        <a-table
          class="table"
          size="small"
          :loading="loading"
          :dataSource="List"
          :columns="columns"
          :pagination="pagination"
          :scroll="{ x: 1630 }"
          @change="paginationChange"
          :sticky="{ offsetHeader: 0 }"
          :body-style="{ overflow: 'hidden' }"
        >
          <template #bodyCell="{ column, record, index }">
            <template v-if="column.dataIndex == 'no'">
              {{ (pagination.current - 1) * pagination.pageSize + index + 1 }}
            </template>
            <template v-else-if="column.dataIndex == 'gender'">
              {{ record.gender == '女性' ? '女性' : '男性' }}
            </template>
            <template v-else-if="column.dataIndex == 'reportState'">
              <span class="reportState" v-if="record.reportState == 'REGISTRATION'">
                <i />
                <i>未完成</i>
              </span>
              <span class="reportState on" v-else>
                <i />
                <i>已完成</i>
              </span>
            </template>
            <template v-else-if="column.dataIndex == 'approvalStatus'">
              <span class="reportState" v-if="record.approvalStatus == 'WAIT_APPROVAL'">
                <i />
                <i>待审核</i>
              </span>
              <span class="reportState on" v-else-if="record.approvalStatus == 'FINISHED'">
                <i />
                <i>审核完成</i>
              </span>
              <span class="reportState run" v-else-if="record.approvalStatus == 'RUNNING'">
                <i />
                <i>生成中</i>
              </span>
              <span class="reportState generate" v-else>
                <i />
                <i>待生成</i>
              </span>
            </template>
            <template v-else-if="column.dataIndex == 'abnormalTypeList'">
              <template v-if="record.abnormalTypeList && record.abnormalTypeList.length > 0">
                <span
                  v-for="(item, index) in record.abnormalTypeList"
                  :key="index"
                  :class="[
                    'abnormal',
                    item == 'A'
                      ? 'abnormalA'
                      : item == 'B+'
                        ? 'abnormalBAdd'
                        : item == 'B'
                          ? 'abnormalB'
                          : ''
                  ]"
                  @click="examineResult(record)"
                >
                  {{ item }}类
                </span>
              </template>
            </template>
            <!-- <template v-else-if="column.dataIndex == 'noticeStatus'">
                <p style="position: relative; margin: 0">
                  <span class="noticeState" v-if="record.approvalStatus == 'WAIT_APPROVAL'">
                    <i></i>
                    <i>通知不成功</i>
                  </span>
                  <span class="noticeState on" v-else-if="record.approvalStatus == 'FINISHED'">
                    <i></i>
                    <i>已通知</i>
                  </span>
                  <span class="noticeState generate" v-else>
                    <i></i>
                    <i>通知待审核</i>
                  </span>
                  <a-button v-if="record.approvalStatus != 'FINISHED'" type="link" class="noticeBtn"
                    >去审核</a-button
                  >
                </p>
              </template> -->
            <template v-else-if="column.dataIndex == 'action'">
              <a-button
                v-if="record.abnormalApprovalStatus != 'FINISHED'"
                type="link"
                @click="handleExamine(record)"
                >去审核</a-button
              >
              <a-button v-else disabled type="link">去审核</a-button>
              <a-button type="link" @click="toExamine(record)">详情</a-button>
              <a-button
                v-if="record.approvalStatus == 'REGISTRATION' || record.approvalStatus == 'INIT'"
                type="link"
                @click="handleReport(record)"
                >手动上报</a-button
              >
              <a-button v-else type="link" disabled>手动上报</a-button>
            </template>
          </template>
        </a-table>
      </div>
    </a-card>
    <Examine ref="examineRef" v-else @close="goBack" />
    <a-modal
      v-model:open="reportShow"
      title="异常结果手动上报"
      :maskClosable="false"
      @ok="handleOk"
      class="abnormalModal"
      width="50%"
    >
      <div class="modal-content">
        <div class="notice-title">
          <span class="on">{{ patientObj.patName }}</span>
          <span>{{ patientObj.age }}岁</span>
          <span>{{ patientObj.gender == '女性' ? '女性' : '男性' }}</span>
          <span>体检号:</span>
          <span class="on">{{ patientObj.peRecordId }}</span>
        </div>
        <a-form
          :model="formState"
          name="basic"
          :label-col="{ span: 3 }"
          :wrapper-col="{ span: 21 }"
          autocomplete="off"
          ref="formRef"
          :rules="rules"
        >
          <a-form-item name="projectValue" label="项目类型">
            <a-select
              v-model:value="formState.projectValue"
              :options="reportStatusList"
              placeholder="请输入项目类型"
              allowClear
              showSearch
              class="type"
              @change="reportStatusChange()"
            />
          </a-form-item>
          <a-form-item name="abnormal" label="异常项目">
            <a-select
              v-model:value="formState.abnormal"
              :options="handReportItemList"
              placeholder="请输入异常项目"
              allowClear
              showSearch
              class="type"
              @change="(value, option) => reportProjectChange(value, option)"
            />
          </a-form-item>
          <a-form-item class="textareaWrap" label="详细描述">
            <div class="textareaWrap">
              <a-textarea
                class="textarea"
                v-model:value="formState.inputText"
                @input="handleInputTwo"
                placeholder="请输入详细描述"
              />
              <p>{{ remainingCharacters }}/1000</p>
            </div>
          </a-form-item>

          <!-- <a-form-item label="已通知" class="radioNotice">
              <a-radio-group v-model:value="formState.notice">
                <a-radio value="1">是</a-radio>
                <a-radio value="2">否</a-radio>
              </a-radio-group>
            </a-form-item> -->
        </a-form>
      </div>
    </a-modal>
    <a-modal
      v-model:open="noticeShow"
      title="通知失败提醒"
      :maskClosable="false"
      @ok="handleOkNotice"
      class="noticeModal"
      width="50%"
    >
      <div class="modal-content">
        <div class="notice-title">
          <p class="left">
            <img src="@/assets/health/warn.png" alt="" />
            <span>2条未读数据</span>
          </p>
          <a-button class="btn" type="primary">全部已读</a-button>
        </div>
        <div class="table">
          <a-table
            class="table"
            size="small"
            :loading="loading"
            :dataSource="failList"
            :columns="failColumns"
            :pagination="pagination"
            @change="paginationChange"
            :sticky="{ offsetHeader: 0 }"
            :scroll="{ y: 300 }"
          >
            <template #bodyCell="{ column, record, index }">
              <template v-if="column.dataIndex == 'no'">
                {{ (pagination.current - 1) * pagination.pageSize + index + 1 }}
              </template>
              <template v-else-if="column.dataIndex == 'abnormal'">
                <span class="abnormal abnormalA"> A类 </span>
                <span class="abnormal abnormalBAdd"> B+类 </span>
                <span class="abnormal abnormalB"> B类 </span>
                <span class="abnormal"> B类 </span>
              </template>
              <template v-else-if="column.dataIndex == 'noticeStatus'">
                <p style="position: relative; margin: 0">
                  <span class="noticeState" v-if="record.approvalStatus == 'WAIT_APPROVAL'">
                    <i>已读</i>
                  </span>
                  <span class="noticeState on" v-else>
                    <i>未读</i>
                  </span>
                </p>
              </template>
              <template v-else-if="column.dataIndex == 'action'">
                <a-button v-if="record.approvalStatus != 'FINISHED'" type="link">标记已读</a-button>
              </template>
            </template>
          </a-table>
        </div>
      </div>
    </a-modal>
    <a-modal
      v-model:open="abnormalExamineShow"
      title="重要异常结果审核"
      :maskClosable="false"
      footer=""
      @ok="handleOkNotice"
      class="abnormalExamineModal"
      width="50%"
      @cancel="handleCancel"
    >
      <div class="modal-content">
        <div v-if="abnormalListWrap && abnormalListWrap.length > 0">
          <div v-for="(item, index) in abnormalListWrap" :key="index">
            <div class="notice-title">
              <span class="on">{{ item.name }}</span>
              <span>{{ item.age }}岁</span>
              <span>{{ item.gender == '女性' ? '女性' : '男性' }}</span>
              <span>体检号:</span>
              <span class="on">{{ item.peRecordId }}</span>
            </div>
            <div class="content" id="contentAbnormalExamine">
              <div v-if="item.abnormalResultList && item.abnormalResultList.length > 0">
                <div
                  class="item"
                  v-for="(itemTwo, indexTwo) in item.abnormalResultList"
                  :key="indexTwo"
                >
                  <div class="abnormalList">
                    <div class="abnormal-item">
                      <div class="result">
                        <div>
                          <p>结果名称</p>
                          <a-select
                            v-model:value="itemTwo.name"
                            style="width: 240px"
                            allowClear
                            showSearch
                            placeholder="请选择结果名称"
                            :options="reportItemList"
                            @change="(value, option) => resultChange(value, option, itemTwo)"
                            :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
                          />
                          <p
                            v-if="itemTwo.abnormalType"
                            :class="[
                              'type',
                              itemTwo.abnormalType == 'A'
                                ? 'abnormalA'
                                : itemTwo.abnormalType == 'B+'
                                  ? 'abnormalBAdd'
                                  : itemTwo.abnormalType == 'B'
                                    ? 'abnormalB'
                                    : ''
                            ]"
                          >
                            {{ itemTwo.abnormalType }}类
                          </p>
                          <a-popconfirm
                            title="你确定要删除这个结论吗？"
                            ok-text="确定"
                            cancel-text="取消"
                            @confirm="confirmFun(itemTwo, indexTwo, index)"
                            @cancel="cancel"
                          >
                            <a-button type="link" danger>删除</a-button>
                          </a-popconfirm>
                        </div>
                        <div class="error" v-if="itemTwo.passCheck === false">
                          该异常已在异常列表中，请勿重复上报
                        </div>
                      </div>
                      <div class="detail on">
                        <p>详细内容</p>
                        <div class="textareaContain">
                          <a-textarea
                            class="textarea"
                            v-model:value="itemTwo.basic"
                            @input="handleInput(itemTwo)"
                            placeholder="请输入详细内容"
                          />
                          <div class="total">{{ itemTwo.valueLength }}/1000</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <a-empty style="margin-top: 120px" v-else />
            </div>
          </div>
          <div class="footer">
            <a-button
              type="primary"
              :disabled="abnormalresultBefore == true ? true : false"
              ghost
              @click="sureResultBefore"
              v-if="!abnormalIsTitle"
              >上一个</a-button
            >
            <a-button type="primary" @click="sureResult">提交审核结果</a-button>
            <a-button
              type="primary"
              :disabled="abnormalresultAfter == true ? true : false"
              ghost
              @click="sureResultAfter"
              v-if="!abnormalIsTitle"
              >下一个</a-button
            >
          </div>
        </div>
        <a-empty style="margin: 120px" v-else />
      </div>
    </a-modal>
    <a-modal
      v-model:open="abnormalresultShow"
      title="重要异常结果"
      :maskClosable="false"
      footer=""
      @ok="handleOkNotice"
      class="abnormalResultModal"
      width="50%"
    >
      <div class="modal-content">
        <div class="content" ref="contentRef">
          <template v-if="abnormalresultList && abnormalresultList.length > 0">
            <div class="item" v-for="(item, index) in abnormalresultList" :key="index">
              <div class="title">{{ item.name }}类异常</div>
              <div class="abnormalList" v-if="item.list && item.list.length > 0">
                <div
                  class="abnormal-item"
                  v-for="(itemChild, indexChild) in item.list"
                  :key="indexChild"
                >
                  <div class="result">{{ indexChild + 1 }}.{{ itemChild.name }}</div>
                  <div class="detail">
                    <p>详细内容</p>
                    <div class="textareaContain">
                      <a-textarea
                        class="textarea"
                        v-model:value="itemChild.basic"
                        @input="handleInput"
                        disabled
                      />
                    </div>
                  </div>
                  <div class="state">
                    <p>结果状态</p>
                    <p
                      :class="[
                        'examineState',
                        (itemChild.approvalStatus == 'FINISHED' && !itemChild.source) ||
                        (itemChild.approvalStatus == 'FINISHED' && itemChild.source == 'AI')
                          ? 'on'
                          : itemChild.approvalStatus == 'FINISHED' && itemChild.source == 'MANUAL'
                            ? 'hand'
                            : ''
                      ]"
                    >
                      {{
                        (itemChild.approvalStatus == 'FINISHED' && !itemChild.source) ||
                        (itemChild.approvalStatus == 'FINISHED' && itemChild.source == 'AI')
                          ? '已审核'
                          : itemChild.approvalStatus == 'FINISHED' && itemChild.source == 'MANUAL'
                            ? '手动上报'
                            : '待审核'
                      }}
                    </p>
                  </div>
                </div>
              </div>
            </div>
          </template>
          <a-empty style="margin-top: 80px" v-else />
        </div>
      </div>
    </a-modal>
  </div>
</template>
<script lang="ts" setup>
import Condition from '@/components/ConditionSearch/index.vue'
import { ref, onMounted, nextTick, computed, createVNode } from 'vue'
import dayjs from 'dayjs'
import { ExclamationCircleOutlined, ExclamationCircleTwoTone } from '@ant-design/icons-vue'
import Examine from './examine.vue'
import {
  recordPage,
  abnormalInfoByEmpiAndPeRecordId,
  getAbnormalWaitApprovalList,
  auditAbnormal,
  mainReportAbnormalLabelsurce,
  getReportItemList,
  getAbnormalWaitApprovalCount,
  uploadAbnormal,
  auditAbnormalCheck,
  auditAbnormalGenerated
} from '@/api/intelligentInspectionReport/index'
import { message, Modal } from 'ant-design-vue'
const showDetail = ref(false)
const loading = ref<boolean>(false)
const reportShow = ref(false)
const formRef = ref(null)
const formState = ref({
  projectValue: undefined,
  abnormal: undefined,
  inputText: ''
  //   notice: '1'
})
const patientObj = ref({})
const handObj = ref({})
// 校验规则
const rules = {
  projectValue: [{ required: true, message: '请输入项目类型', trigger: 'change' }],
  abnormal: [{ required: true, message: '请输入异常项目', trigger: 'change' }]
}
const noticeShow = ref(false)
const List = ref<any[]>([])
const reportStatusList = ref<any[]>([])
const condition = ref([
  {
    title: '',
    dataIndex: 'condition',
    type: 'input',
    value: '',
    placeholder: '请输入姓名/体检号/手机号/证件号',
    style: { width: '270px' }
  },
  {
    title: '性别',
    dataIndex: 'gender',
    type: 'select',
    data: [
      { label: '全部', value: '' },
      { label: '男性', value: 1 },
      { label: '女性', value: 2 }
    ],
    value: undefined,
    placeholder: '请选择性别',
    style: { width: '120px' }
  },
  {
    title: '体检数据状态',
    dataIndex: 'reportStatus',
    type: 'select',
    data: [
      { label: '全部', value: '' },
      { label: '已完成', value: 1 },
      { label: '未完成', value: 2 }
    ],
    placeholder: '请选择体检数据状态',
    value: undefined
  },
  {
    title: '主检报告状态',
    dataIndex: 'approvalStatus',
    type: 'select',
    data: [
      { label: '全部', value: '' },
      { label: '待生成', value: 'INIT' },
      { label: '生成中', value: 'RUNNING' },
      { label: '待审核', value: 'WAIT_APPROVAL' },
      { label: '审核完成', value: 'FINISHED' }
    ],
    placeholder: '请选择主检报告状态',
    value: undefined
  },
  {
    title: '结果类型',
    dataIndex: 'abnormalType',
    type: 'select',
    data: reportStatusList,
    placeholder: '请选择结果类型',
    value: undefined
  },
  //   {
  //     title: '通知状态',
  //     dataIndex: 'reportStatus',
  //     type: 'select',
  //     data: [
  //       { label: '全部', value: '' },
  //       { label: '通知待审核', value: 1 },
  //       { label: '通知不成功', value: 2 },
  //       { label: '已通知', value: 3 }
  //     ],
  //     placeholder: '请选择体检数据状态',
  //     value: undefined
  //   },
  {
    title: '体检时间',
    dataIndex: 'visitTime',
    type: 'dayRange',
    value: []
  }
])
const columns = ref<any[]>([
  {
    title: '序号',
    dataIndex: 'no',
    key: 'no',
    align: 'left',
    width: 60,
    fixed: 'left'
  },
  {
    title: '体检号',
    dataIndex: 'peRecordId',
    key: 'peRecordId',
    align: 'left',
    width: 140,
    fixed: 'left'
  },
  {
    title: '患者',
    dataIndex: 'patName',
    key: 'patName',
    align: 'left',
    width: 80,
    fixed: 'left'
  },
  {
    title: '性别',
    dataIndex: 'gender',
    key: 'gender',
    align: 'left',
    width: 80
  },
  {
    title: '年龄',
    dataIndex: 'age',
    key: 'age',
    align: 'left',
    width: 80
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    key: 'phone',
    align: 'left',
    width: 100
  },
  {
    title: '证件号',
    dataIndex: 'idNo',
    key: 'idNo',
    align: 'left',
    width: 150
  },
  {
    title: '体检时间',
    dataIndex: 'peTime',
    key: 'peTime',
    align: 'left',
    width: 160
  },
  {
    title: '体检数据状态',
    dataIndex: 'reportState',
    key: 'reportState',
    align: 'left',
    width: 100
  },
  {
    title: '主检报告状态',
    dataIndex: 'approvalStatus',
    key: 'approvalStatus',
    align: 'left',
    width: 100
  },
  {
    title: '重要异常结果情况',
    dataIndex: 'abnormalTypeList',
    key: 'abnormalTypeList',
    align: 'left',
    width: 200
  },
  //   {
  //     title: '通知状态',
  //     dataIndex: 'noticeStatus',
  //     key: 'noticeStatus',
  //     align: 'left',
  //     width: 200
  //   },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    align: 'left',
    width: 180,
    fixed: 'right'
  }
])
const failColumns = ref<any[]>([
  {
    title: '序号',
    dataIndex: 'no',
    key: 'no',
    align: 'left',
    width: 50
  },
  {
    title: '时间',
    dataIndex: 'peTime',
    key: 'peTime',
    align: 'left',
    width: 160
  },
  {
    title: '体检号',
    dataIndex: 'peRecordId',
    key: 'peRecordId',
    align: 'left'
  },
  {
    title: '重要异常结果情况',
    dataIndex: 'abnormal',
    key: 'abnormal',
    align: 'left',
    width: 200
  },
  {
    title: '状态',
    dataIndex: 'noticeStatus',
    key: 'noticeStatus',
    align: 'left',
    width: 60
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    align: 'left',
    width: 100
  }
])
const failList = ref<any[]>([])
const abnormalExamineShow = ref(false)
const abnormalIsTitle = ref(false)
const contentRef = ref()
const abnormalList = ref([])
const abnormalWaitApprovalCount = ref(0)
const abnormalListWrap = ref([])
const abnormalCheckListWrap = ref([])
const abnormalCheckisShow = ref(false)
const abnormalresultShow = ref(false)
const abnormalresultBefore = ref(false)
const abnormalresultAfter = ref(false)
const reportItemList = ref([])
const handReportItemList = ref([])

const abnormalresultList = ref([])
const abnormalresultNum = ref(0)
const pagination = ref<any>({
  current: 1,
  total: 0,
  pageSize: 10,
  showSizeChanger: true,
  pageSizeOptions: ['10', '20', '50', '100'],
  showQuickJumper: true
})
const paginationChange = (page: any) => {
  pagination.value = { ...page }
  loading.value = true
  getDataList()
}
const getDataList = () => {
  const obj = condition.value.reduce((c, v) => {
    if (v.value || v.value === 0) {
      if (v.dataIndex == 'visitTime') {
        return Object.assign(c, {
          start: v.value.length ? dayjs(v.value[0]).format('YYYY-MM-DD 00:00:00') : '',
          end: v.value.length ? dayjs(v.value[1]).format('YYYY-MM-DD 23:59:59') : ''
        })
      } else {
        return Object.assign(c, { [v.dataIndex]: v.value })
      }
    } else {
      return c
    }
  }, {})
  loading.value = false
  recordPage({
    ...obj,
    page: pagination.value.current,
    limit: pagination.value.pageSize
  })
    .then((res) => {
      List.value = res.data.list
      // 先放一下测试需要数据
      //   failList.value = res.data.list
      pagination.value.total = res.data.total
      loading.value = false
    })
    .catch(() => {
      loading.value = false
    })
}
const remainingCharacters = computed(() => {
  return formState.value.inputText.trim().length
})
onMounted(() => {
  loading.value = true
  getDataList()
  mainReportAbnormalLabelsurceFun()
  getReportItemListFun()
  getAbnormalWaitApprovalCountFun()
})
const mainReportAbnormalLabelsurceFun = () => {
  reportStatusList.value = []
  mainReportAbnormalLabelsurce({}).then((res) => {
    if (res.code == 0) {
      if (res.data) {
        reportStatusList.value = JSON.parse(res.data)
      } else {
        reportStatusList.value = []
      }
    }
  })
}
const getReportItemListFun = () => {
  reportItemList.value = []
  handReportItemList.value = []
  getReportItemList({}).then((res) => {
    if (res.code == 0) {
      if (res.data && res.data.length > 0) {
        reportItemList.value = res.data.map((item) => {
          return { ...item, label: item.name, value: item.itemCode }
        })
        handReportItemList.value = JSON.parse(JSON.stringify(reportItemList.value))
      } else {
        reportItemList.value = []
        handReportItemList.value = []
      }
    }
  })
}
const getAbnormalWaitApprovalCountFun = () => {
  abnormalWaitApprovalCount.value = 0
  getAbnormalWaitApprovalCount({}).then((res) => {
    if (res.code == 0) {
      abnormalWaitApprovalCount.value = res.data
    }
  })
}
const examineRef = ref()
const toExamine = (data: any) => {
  showDetail.value = true
  nextTick(() => {
    examineRef.value.init(data)
  })
}
const searchHandle = () => {
  pagination.value.current = 1
  loading.value = true
  getDataList()
  getAbnormalWaitApprovalCountFun()
}
const reset = () => {
  pagination.value.current = 1
  pagination.value.pageSize = 10
  condition.value.map((v) => {
    if (v.type === 'select') {
      v.value = undefined
    } else if (v.type === 'dayRange') {
      v.value = []
    } else {
      v.value = ''
    }
  })
  loading.value = true
  getDataList()
  getAbnormalWaitApprovalCountFun()
}
const handleInput = (item) => {
  if (item.basic.trim().length > 1000) {
    item.basic = item.basic.trim().slice(0, 1000) // 截断超出长度的部分
    item.valueLength = 0
  } else {
    item.valueLength = item.basic.length
  }
}
const handleInputTwo = () => {
  if (formState.value.inputText.trim().length > 1000) {
    formState.value.inputText = formState.value.inputText.trim().slice(0, 1000) // 截断超出长度的部分
  }
}

// 提交审核结果
const sureResult = () => {
  let firstEmptyIndex = null
  for (let i = 0; i < abnormalListWrap.value[0].abnormalResultList.length; i++) {
    const parent = abnormalListWrap.value[0].abnormalResultList[i]
    if (!parent.name || parent.name == null || parent.name == undefined) {
      firstEmptyIndex = { parentIndex: i }
      break // 找到第一个后立即退出循环
    }
    if (firstEmptyIndex !== null) {
      break // 找到第一个后立即退出外层循环
    }
  }
  if (firstEmptyIndex !== null) {
    const contentAbnormalExamine = document.getElementById('contentAbnormalExamine')
    const numberIndex =
      firstEmptyIndex && firstEmptyIndex.parentIndex ? firstEmptyIndex.parentIndex : 0
    contentAbnormalExamine.scrollTo({
      top: 200 * numberIndex,
      behavior: 'smooth'
    })
    // message.error('请完善信息，再提交审核')
  } else {
    const param =
      abnormalListWrap.value && abnormalListWrap.value[0] ? abnormalListWrap.value[0] : {}
    auditAbnormalCheck(param).then((res) => {
      if (res.code == 0) {
        if (res.data && res.data.passAllCheck == true) {
          auditAbnormal(param).then((res) => {
            if (res.code == 0) {
              if (abnormalIsTitle.value == true) {
                message.success('审核成功')
                abnormalExamineShow.value = false
                getDataList()
                getAbnormalWaitApprovalCountFun()
              } else {
                const addIndexAfter = abnormalresultNum.value + 1
                if (
                  abnormalList.value[addIndexAfter] &&
                  abnormalList.value[addIndexAfter].peRecordId
                ) {
                  // 删除当前的对象，返回最新的列表
                  abnormalList.value = Array.from(abnormalList.value).filter(
                    (_, index) => index !== abnormalresultNum.value
                  )
                  abnormalresultNum.value =
                    abnormalresultNum.value - 1 <= 0 ? 0 : abnormalresultNum.value - 1
                  sureResultAfter('after')
                } else {
                  // 删除当前的对象，返回最新的列表
                  abnormalList.value = Array.from(abnormalList.value).filter(
                    (_, index) => index !== abnormalresultNum.value
                  )
                  sureResultBefore()
                }
              }
            } else {
              message.error('审核失败')
            }
          })
        } else {
          abnormalCheckisShow.value = true
          const dataList = res.data.abnormalResultList
          // 步骤1: 遍历原数组，筛选出 passCheck 为 false 的对象
          const passCheckFalseItems = dataList.filter((item) => item.passCheck === false)
          // 步骤2: 根据 id 映射这些对象，便于快速查找
          const passCheckFalseMap = new Map()
          passCheckFalseItems.forEach((item) => {
            passCheckFalseMap.set(item.id, item)
          })
          // 步骤3: 生成最终数组（替换逻辑）
          const finalArray = abnormalList.value[abnormalresultNum.value].abnormalResultList.map(
            (item) => {
              // 如果当前项的 id 在 passCheckFalseMap 中存在，则替换
              if (passCheckFalseMap.has(item.id)) {
                return passCheckFalseMap.get(item.id)
              }
              // 否则保留原项
              return item
            }
          )
          abnormalList.value[abnormalresultNum.value].abnormalResultList = finalArray
          //   dataList
          let firstEmptyIndexTwo = null
          for (let i = 0; i < dataList.length; i++) {
            if (dataList[i].passCheck == false) {
              firstEmptyIndexTwo = i
              break // 找到第一个后立即退出循环
            }
            if (firstEmptyIndexTwo !== null) {
              break // 找到第一个后立即退出外层循环
            }
          }
          const contentAbnormalExamineTwo = document.getElementById('contentAbnormalExamine')
          const numberIndexTwo = firstEmptyIndexTwo ? firstEmptyIndexTwo : 0
          contentAbnormalExamineTwo.scrollTo({
            top: 200 * numberIndexTwo,
            behavior: 'smooth'
          })
        }
      } else {
        message.error('审核失败')
      }
    })
  }
}
const handleCancel = () => {
  abnormalExamineShow.value = false
  getDataList()
  getAbnormalWaitApprovalCountFun()
}
const reportStatusChange = () => {
  handReportItemList.value = []
  formState.value.abnormal = undefined
  if (formState.value.projectValue) {
    if (formState.value.projectValue == 'all') {
      handReportItemList.value = reportItemList.value
    } else {
      handReportItemList.value = reportItemList.value.filter(
        (item) => item.abnormalType === formState.value.projectValue
      )
    }
  } else {
    handReportItemList.value = reportItemList.value
  }
}
const reportProjectChange = (value, option) => {
  handObj.value = option ? option : {}
  if (value) {
    formState.value.projectValue = option.abnormalType
    handReportItemList.value = reportItemList.value.filter(
      (item) => item.abnormalType === formState.value.projectValue
    )
    formRef.value.validate().then(() => {
      console.log('校验一下')
    })
  }
}

const sureResultAfter = (afterNum) => {
  const contentAbnormalExamine = document.getElementById('contentAbnormalExamine')
  contentAbnormalExamine.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
  if (abnormalCheckisShow.value == true) {
    abnormalCheckListWrap.value[0].abnormalResultList.forEach((obj) => {
      obj.passCheck = null
    })
    abnormalList.value[abnormalresultNum.value] = abnormalCheckListWrap.value[0]
  }
  abnormalListWrap.value = []
  abnormalCheckListWrap.value = []
  if (afterNum == 'after') {
    abnormalresultNum.value = abnormalresultNum.value
  } else {
    abnormalresultNum.value = abnormalresultNum.value + 1
  }
  if (
    abnormalList.value[abnormalresultNum.value] &&
    abnormalList.value[abnormalresultNum.value].peRecordId
  ) {
    abnormalListWrap.value.push(abnormalList.value[abnormalresultNum.value])
    abnormalCheckListWrap.value.push(
      JSON.parse(JSON.stringify(abnormalList.value[abnormalresultNum.value]))
    )
    if (afterNum == 'after') {
      if (
        abnormalList.value[abnormalresultNum.value - 1] &&
        abnormalList.value[abnormalresultNum.value - 1].peRecordId
      ) {
        abnormalresultBefore.value = false
      } else {
        abnormalresultBefore.value = true
      }
    } else {
      abnormalresultBefore.value = false
    }

    // 判断是否还有下一个
    const addIndex = abnormalresultNum.value + 1
    if (abnormalList.value[addIndex] && abnormalList.value[addIndex].peRecordId) {
      abnormalresultAfter.value = false
    } else {
      abnormalresultAfter.value = true
    }
  } else {
    abnormalresultAfter.value = true
  }
}
const sureResultBefore = () => {
  const contentAbnormalExamine = document.getElementById('contentAbnormalExamine')
  contentAbnormalExamine.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
  if (abnormalCheckisShow.value == true) {
    abnormalCheckListWrap.value[0].abnormalResultList.forEach((obj) => {
      obj.passCheck = null
    })
    abnormalList.value[abnormalresultNum.value] = abnormalCheckListWrap.value[0]
  }
  abnormalListWrap.value = []
  abnormalCheckListWrap.value = []
  abnormalresultNum.value = abnormalresultNum.value - 1 <= 0 ? 0 : abnormalresultNum.value - 1
  if (
    abnormalList.value[abnormalresultNum.value] &&
    abnormalList.value[abnormalresultNum.value].peRecordId
  ) {
    abnormalListWrap.value.push(abnormalList.value[abnormalresultNum.value])
    abnormalCheckListWrap.value.push(
      JSON.parse(JSON.stringify(abnormalList.value[abnormalresultNum.value]))
    )
    const addIndexAfter = abnormalresultNum.value + 1
    if (abnormalList.value[addIndexAfter] && abnormalList.value[addIndexAfter].peRecordId) {
      abnormalresultAfter.value = false
    } else {
      abnormalresultAfter.value = true
    }
    // 判断是否还有上一个
    const addIndex = abnormalresultNum.value - 1
    if (abnormalList.value[addIndex] && abnormalList.value[addIndex].peRecordId) {
      abnormalresultBefore.value = false
    } else {
      abnormalresultBefore.value = true
    }
  }
}

const handleReport = (item) => {
  const param = {
    peRecordId: item.peRecordId
  }
  auditAbnormalGenerated(param)
    .then((res) => {
      if (res.code == 0) {
        if (item) {
          patientObj.value = item
        } else {
          patientObj.value = {}
        }
        formState.value.abnormal = undefined
        formState.value.projectValue = undefined
        formState.value.inputText = ''
        handReportItemList.value = reportItemList.value
        //   formState.value.notice = '1'
        if (formRef.value) {
          formRef.value.resetFields()
        }
        reportShow.value = !reportShow.value
      }
    })
    .catch((error) => {
      if (error.code == 1) {
        Modal.info({
          title: '提示',
          icon: createVNode(ExclamationCircleTwoTone, {
            twoToneColor: '#ff7d01'
          }),
          content: error.msg,
          //   okText: '确认',
          onOk() {
            getDataList()
            getAbnormalWaitApprovalCountFun()
          }
        })
      }
    })
}
const updateHandleReport = (item) => {
  console.log(item)
  console.log(formRef.value)
  Modal.confirm({
    title: '提示',
    icon: createVNode(ExclamationCircleOutlined),
    content: '确定更新通知!',
    okText: '确认',
    cancelText: '取消'
  })
}
const handleNotice = () => {
  noticeShow.value = !noticeShow.value
}

const resultChange = (value, option, item) => {
  item.name = option && option.name ? option.name : undefined
  item.icdCode = option && option.icdCode ? option.icdCode : ''
  item.itemCode = option && option.itemCode ? option.itemCode : ''
  item.abnormalType = option && option.abnormalType ? option.abnormalType : ''
  item.passCheck = null
}
const handleExamine = (item) => {
  abnormalList.value = []
  abnormalListWrap.value = []
  abnormalCheckListWrap.value = []
  abnormalresultNum.value = 0
  const param = {}
  if (item) {
    abnormalIsTitle.value = true
    param.peRecordId = item.peRecordId
  } else {
    abnormalIsTitle.value = false
  }
  getAbnormalWaitApprovalList(param).then((res) => {
    let abnormalresultWrap = []
    if (res.data && res.data.length > 0) {
      abnormalresultWrap = res.data
      abnormalList.value = abnormalresultWrap.map((item) => {
        item.isShow = false
        const abnormalResultList = item.abnormalResultList.map((key) => ({
          ...key,
          valueLength: key.basic ? key.basic.length : '0',
          //   name: undefined
          name: key.name,
          value: key.itemCode
        }))
        return {
          ...item,
          abnormalResultList
        }
      })
      abnormalresultBefore.value = true
      if (item) {
        abnormalListWrap.value.push(abnormalList.value[0])
        abnormalCheckListWrap.value.push(JSON.parse(JSON.stringify(abnormalList.value[0])))
      } else {
        if (
          abnormalList.value[abnormalresultNum.value + 1] &&
          abnormalList.value[abnormalresultNum.value + 1].peRecordId
        ) {
          abnormalresultAfter.value = false
        } else {
          abnormalresultAfter.value = true
        }
        abnormalListWrap.value.push(abnormalList.value[abnormalresultNum.value])
        abnormalCheckListWrap.value.push(
          JSON.parse(JSON.stringify(abnormalList.value[abnormalresultNum.value]))
        )
      }

      abnormalExamineShow.value = true
    } else {
      abnormalList.value = []
      abnormalListWrap.value = []
      abnormalCheckListWrap.value = []
      abnormalExamineShow.value = true
    }
  })
}
// 假删除
const confirmFun = (item, indexTwo, indexActive) => {
  //   let param = {
  //     abnormalResultId: item.peRecordId
  //   }
  //   delAbnormal(param).then((res) => {
  //     if (res.code == 0) {
  //     }
  //   })
  abnormalListWrap.value = abnormalListWrap.value.map((item, index) => {
    // 对索引为1的元素进行处理
    if (index === 0) {
      // 创建新对象并拷贝所有属性
      const newItem = { ...item }
      // 创建新的abnormalResultList数组，排除索引为2的元素
      newItem.abnormalResultList = newItem.abnormalResultList.filter((_, idx) => idx !== indexTwo)
      return newItem
    }
    // 其他元素直接浅拷贝
    return { ...item }
  })
}
const cancel = () => {
  console.log('取消')
}

const handleOkNotice = () => {
  noticeShow.value = !noticeShow.value
}
const examineResult = (item) => {
  abnormalresultList.value = []
  abnormalresultShow.value = true
  abnormalInfoByEmpiAndPeRecordId({
    empi: item.empi,
    peRecordId: item.peRecordId
  }).then((res) => {
    let abnormalresultWrap = {}
    if (res.data) {
      abnormalresultWrap = res.data
      abnormalresultList.value = Object.keys(abnormalresultWrap).map((key) => ({
        name: key,
        list: abnormalresultWrap[key]
      }))
    }
  })
}
const handleOk = () => {
  formRef.value
    .validate()
    .then(() => {
      const param = {
        empi: patientObj.value.empi,
        peRecordId: patientObj.value.peRecordId,
        abnormalType: formState.value.projectValue,
        name: handObj.value.name,
        itemCode: handObj.value.itemCode,
        icdCode: handObj.value.icdCode,
        basic: formState.value.inputText
      }
      uploadAbnormal(param)
        .then((res) => {
          if (res.code == 0) {
            reportShow.value = false
            message.success('上报成功')
            getDataList()
            getAbnormalWaitApprovalCountFun()
          }
        })
        .catch((error) => {
          if (error.code == 1) {
            Modal.info({
              title: '提示',
              icon: createVNode(ExclamationCircleTwoTone, {
                twoToneColor: '#ff7d01'
              }),
              content: error.msg,
              onOk() {
                reportShow.value = false
                getDataList()
                getAbnormalWaitApprovalCountFun()
              }
            })
          }
          console.log('校验失败:', error)
        })
    })
    .catch((error) => {
      // message.error('处理失败')
      console.log('校验失败:', error)
    })
}
const goBack = (value) => {
  showDetail.value = false
  loading.value = true
  getDataList()
}
</script>
<style lang="less" scoped>
::v-deep(.ant-form) {
  .ant-input {
    width: 100% !important;
  }
}

.header {
  display: flex;
  justify-content: space-between;

  .total {
    position: relative;
    padding-top: 15px;

    .right {
      position: absolute;
      top: calc(50% + 5px);
      right: 0;
      transform: translateY(-50%);

      ::v-deep(.btn) {
        display: inline-block;
        margin-right: 24px;
        vertical-align: middle;

        &:nth-child(3) {
          margin-right: 5px;
        }
      }
    }
  }
}

.main {
  flex: 1 1 auto;
  margin-top: 16px;
  overflow: hidden auto;

  ::v-deep(.table) {
    .ant-table-body {
      //   overflow: hidden !important;
    }

    .ant-table-sticky-scroll {
      //   display: none !important;
    }

    .reportState {
      i {
        display: inline-block;
        font-style: normal;
        color: #000;
        vertical-align: middle;

        &:nth-child(1) {
          width: 6px;
          height: 6px;
          margin-right: 5px;
          background-color: #f53f3f;
          border-radius: 6px;
        }
      }

      &.on {
        i {
          color: #1d2129;

          &:nth-child(1) {
            background-color: #00b42a;
          }
        }
      }

      &.generate {
        i {
          color: #1d2129;

          &:nth-child(1) {
            background-color: #ff7d00;
          }
        }
      }

      &.run {
        i {
          color: #1d2129;

          &:nth-child(1) {
            background-color: #3491fa;
          }
        }
      }
    }

    .abnormal {
      display: inline-block;
      height: 20px;
      padding: 0 8px;
      margin: 4px 8px 0 0;
      line-height: 20px;
      color: #f7ba1e;
      vertical-align: middle;
      background-color: #fffce8;
      border: 1px solid #f7ba1e;
      border-radius: 2px;

      &.abnormalA {
        color: #f53f3f;
        background-color: #ffece8;
        border: 1px solid #f53f3f;
      }

      &.abnormalBAdd {
        color: #f5319d;
        background-color: #ffe8f1;
        border: 1px solid #f5319d;
      }

      &.abnormalB {
        color: #ff7d00;
        background-color: #fff7e8;
        border: 1px solid #ff7d00;
      }

      &:hover {
        cursor: pointer;
        opacity: 0.8;
      }
    }

    .noticeState {
      i {
        display: inline-block;
        font-style: normal;
        color: #000;
        vertical-align: middle;

        &:nth-child(1) {
          width: 6px;
          height: 6px;
          margin-right: 5px;
          background-color: #f53f3f;
          border-radius: 6px;
        }
      }

      &.on {
        i {
          color: #1d2129;

          &:nth-child(1) {
            background-color: #00b42a;
          }
        }
      }

      &.generate {
        i {
          color: #1d2129;

          &:nth-child(1) {
            background-color: #ff7d00;
          }
        }
      }
    }

    .noticeBtn {
      position: absolute;
      top: 50%;
      right: 10px;
      transform: translateY(-50%);
    }
  }
}
</style>
<style>
.abnormalModal .ant-form-item.textareaWrap {
  margin-bottom: 0;
}

.abnormalModal .ant-form-item.radioNotice {
  margin-bottom: 0;
}

.abnormalModal .modal-content .notice-title {
  position: relative;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: #fff7e8;
  border-radius: 2px;
}

.abnormalModal .modal-content .notice-title span {
  display: inline-block;
  margin-right: 12px;
  font-size: 14px;
  color: #4e5969;
  vertical-align: middle;
}

.abnormalModal .modal-content .notice-title span.on {
  color: #1d2129;
}

.abnormalModal .ant-form-item.radioNotice .ant-form-item-label::before {
  display: inline-block;
  margin-right: 4px;
  font-family: SimSun, sans-serif;
  font-size: 14px;
  line-height: 1;
  color: #ff4d4f;
  content: '*';
}

.abnormalModal .ant-form-item-control .type {
  width: 100%;
}

.abnormalModal .ant-form-item-control .textareaWrap {
  width: 100%;
}

.abnormalModal .textareaWrap .textarea {
  width: 100%;
  height: 200px;
  padding: 5px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
}

.abnormalModal .textareaWrap .textarea:focus {
  outline: none;
}

.abnormalModal .textareaWrap p {
  margin: 0;
  text-align: right;
}

.noticeModal .modal-content .notice-title {
  position: relative;
  padding: 8px 16px;
  background: #fff7e8;
  border-radius: 2px;
}

.noticeModal .modal-content .notice-title .left {
  margin: 0;
}

.noticeModal .modal-content .notice-title .left img {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
}

.noticeModal .modal-content .notice-title .left span {
  display: inline-block;
  font-size: 14px;
  color: #ff7d00;
  vertical-align: middle;
}

.noticeModal .modal-content .notice-title .btn {
  position: absolute;
  top: 50%;
  right: 16px;
  height: 24px;
  padding: 0 10px;
  line-height: 18px;
  transform: translateY(-50%);
}

.noticeModal .modal-content .notice-title .btn span {
  font-size: 12px;
}

.noticeModal .modal-content .table {
  margin-top: 16px;
}

.noticeModal .modal-content .table .abnormal {
  display: inline-block;
  height: 20px;
  padding: 0 8px;
  margin: 4px 8px 0 0;
  line-height: 20px;
  color: #f7ba1e;
  vertical-align: middle;
  background-color: #fffce8;
  border: 1px solid #f7ba1e;
  border-radius: 2px;
}

.noticeModal .modal-content .table .abnormal.abnormalA {
  color: #f53f3f;
  background-color: #ffece8;
  border: 1px solid #f53f3f;
}

.noticeModal .modal-content .table .abnormal.abnormalBAdd {
  color: #f5319d;
  background-color: #ffe8f1;
  border: 1px solid #f5319d;
}

.noticeModal .modal-content .table .abnormal.abnormalB {
  color: #ff7d00;
  background-color: #fff7e8;
  border: 1px solid #ff7d00;
}

.noticeModal .modal-content .table .abnormal:hover {
  cursor: pointer;
  opacity: 0.8;
}

.noticeModal .modal-content .table .noticeState i {
  padding: 4px 10px;
  font-size: 12px;
  font-style: normal;
  color: #4e5969;
  background: #f2f3f5;
  border-radius: 2px;
}

.noticeModal .modal-content .table .noticeState.on i {
  color: #f53f3f;
  background: #ffece8;
}

.noticeModal .modal-content .table .ant-pagination {
  margin: 20px 0 0;
}

.abnormalExamineModal .modal-content .notice-title {
  position: relative;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: #fff7e8;
  border-radius: 2px;
}

.abnormalExamineModal .modal-content .notice-title span {
  display: inline-block;
  margin-right: 12px;
  font-size: 14px;
  color: #4e5969;
  vertical-align: middle;
}

.abnormalExamineModal .modal-content .notice-title span.on {
  color: #1d2129;
}

.abnormalExamineModal .modal-content .content {
  height: 440px;
  margin: 0 0 24px;
  overflow: auto;
}

.abnormalExamineModal .modal-content .item {
  margin-top: 16px;
}

.abnormalExamineModal .modal-content .item:nth-child(1) {
  margin-top: 0;
}

.abnormalExamineModal .modal-content .item .title {
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 32px;
  color: #165dff;
  background: #e8f3ff;
}

.abnormalExamineModal .abnormalList .abnormal-item {
  padding: 12px 16px;
  margin-top: 12px;
  background: #f7f8fa;
}

.abnormalExamineModal .abnormalList .abnormal-item:nth-child(1) {
  margin-top: 0;
}

.abnormalExamineModal .abnormalList .abnormal-item .result {
  position: relative;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .error {
  position: absolute;
  bottom: -23px;
  left: 80px;
  font-size: 14px;
  color: #ff4d4f;
}

.abnormalExamineModal .abnormalList .abnormal-item .result p {
  display: inline-block;
  width: 80px;
  margin: 0;
  vertical-align: middle;
}

.abnormalExamineModal .abnormalList .abnormal-item .result p:nth-child(1)::before {
  display: inline-block;
  margin-right: 4px;
  font-family: SimSun, sans-serif;
  font-size: 14px;
  line-height: 1;
  color: #ff4d4f;
  content: '*';
}

.abnormalExamineModal .abnormalList .abnormal-item .result .type {
  display: inline-block;
  width: auto;
  height: 24px;
  padding: 0 8px;
  margin: 0 0 0 8px;
  font-size: 14px;
  line-height: 24px;
  color: #f7ba1e;
  text-align: center;
  vertical-align: middle;
  background: #fffce8;
  border: 1px solid #f7ba1e;
  border-radius: 2px;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .type.abnormalA {
  color: #f53f3f;
  background-color: #ffece8;
  border: 1px solid #f53f3f;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .type.abnormalBAdd {
  color: #f5319d;
  background-color: #ffe8f1;
  border: 1px solid #f5319d;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .type.abnormalB {
  color: #ff7d00;
  background-color: #fff7e8;
  border: 1px solid #ff7d00;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .ant-input {
  display: inline-block;
  width: calc(100% - 80px - 76px);
  vertical-align: middle;
}

.abnormalExamineModal .abnormalList .abnormal-item .result .ant-btn {
  position: absolute;
  top: 50%;
  right: 0;
  margin: 0;
  transform: translateY(-50%);
}

.abnormalExamineModal .abnormalList .abnormal-item .detail {
  margin-top: 24px;
}

.abnormalExamineModal .abnormalList .abnormal-item .detail p {
  display: inline-block;
  width: 80px;
  margin: 0;
  vertical-align: top;
}

.abnormalExamineModal .abnormalList .abnormal-item .detail p::before {
  display: inline-block;
  margin-right: 4px;
  font-family: SimSun, sans-serif;
  font-size: 14px;
  line-height: 1;
  color: #ff4d4f;
  content: '*';
}

.abnormalExamineModal .abnormalList .abnormal-item .detail.on p::before {
  content: '';
}

.abnormalExamineModal .abnormalList .abnormal-item .detail .textareaContain {
  position: relative;
  display: inline-block;
  width: calc(100% - 80px);
  height: 112px;
  vertical-align: top;
}

.abnormalExamineModal .abnormal-item .detail .textareaContain .textarea {
  display: block;
  width: 100%;
  height: 100%;
  padding-bottom: 20px;
}

.abnormalExamineModal .abnormal-item .detail .textareaContain .total {
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 0 10px;
  background: #fff;
}

.abnormalExamineModal .modal-content .footer {
  text-align: center;
  border-top: 1px solid #f0f0f0;
}

.abnormalExamineModal .modal-content .ant-btn {
  margin: 16px 0 6px;
  text-align: center;
}

.abnormalExamineModal .modal-content .ant-btn:nth-child(2) {
  margin: 0 8px;
}

.abnormalResultModal .modal-content {
  position: relative;
  padding: 8px 16px;
  border-radius: 2px;
}

.abnormalResultModal .modal-content .content {
  height: 420px;
  overflow: auto;
}

.abnormalResultModal .modal-content .item {
  margin-top: 16px;
}

.abnormalResultModal .modal-content .item:nth-child(1) {
  margin-top: 0;
}

.abnormalResultModal .modal-content .item .title {
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 32px;
  color: #165dff;
  background: #e8f3ff;
}

.abnormalResultModal .abnormalList .abnormal-item {
  padding: 12px 16px 0;
}

.abnormalResultModal .abnormalList .abnormal-item .result {
  font-size: 14px;
  font-weight: 700;
  color: #1d2129;
}

.abnormalResultModal .abnormalList .abnormal-item .detail {
  margin-top: 12px;
}

.abnormalResultModal .abnormalList .abnormal-item .detail p {
  display: inline-block;
  width: 65px;
  margin: 0;
  text-align: right;
  vertical-align: top;
}

.abnormalResultModal .abnormalList .abnormal-item .detail .textareaContain {
  display: inline-block;
  width: calc(100% - 75px);
  height: 100px;
  margin-left: 10px;
  vertical-align: top;
}

.abnormalResultModal .abnormalList .detail .textareaContain .textarea {
  height: 100%;
}

.abnormalResultModal .abnormalList .state {
  margin-top: 12px;
}

.abnormalResultModal .abnormalList .state p {
  display: inline-block;
  width: 65px;
  margin: 0;
  font-size: 14px;
  text-align: right;
  vertical-align: middle;
}

.abnormalResultModal .abnormalList .state .examineState {
  padding: 2px 8px;
  margin-left: 10px;
  color: #ff7d00;
  text-align: center;
  background: #fff7e8;
  border-radius: 2px;
}

.abnormalResultModal .abnormalList .state .examineState.on {
  color: #3491fa;
  background: #e8f7ff;
}

.abnormalResultModal .abnormalList .state .examineState.hand {
  width: auto;
  color: #722ed1;
  background: #f5e8ff;
}
</style>
